<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec"    uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="ms-theme-blue">

  <%@ include file="/WEB-INF/include/header.jsp"%>
  <%@ include file="/WEB-INF/include/submenu.jsp"%>
  
  <div class="container-fluid ms-container has-ms-sidemenu">
    
    <ol class="ms-breadcrumb breadcrumb">
      <li class="active">运输收入明细报表预约管理</li>
    </ol>
    
    <div class="ms-content-layout has-operation">
    
      <div class="alert alert-warning" role="alert">
        <strong>1. 每家公司每天允许对同一个报表预约2次。</strong><br/>
        <strong>2. 每个报表的导出上限为30万条（CSV格式）。</strong><br/>
        <strong>3. 当天预约后，系统将会于第二天早上0:00~6:00间进行导出，预约的客户可以于次日7点后下载到此数据。</strong><br/>
        <strong>4. 每天预约的导出信息保留3天，3天后不可下载。</strong><br/>
        <strong>5. 添加预约后，系统需要自动检查所选择的预约是否符合导出要求，请过30分钟后回到本页面查看是否预约成功。</strong>
      </div>
    
      <div class="ms-operation-bar no-margin no-bottom-border clearfix">
        <div class="ms-operation-group pull-right">
          <a href="${ctx.host}/transport-revenue-appointments/create"  data-target="#create" data-toggle="modal" class="btn ms-btn ms-btn-blue" >
            <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;添加预约
          </a>
        </div>
      </div>
    
      <table class="table table-hover ms-table">
        <thead>
          <tr>
            <th>预约号</th>
            <th>运输公司</th>
            <th>预约人</th>
            <th>预约时间</th>
            <th>报表状态</th>
            <th class="text-center">操作</th>
          </tr>
        </thead>
        <tbody>
          <c:forEach items="${appointments}" var="appointment">
            <tr>
              <td>${appointment.code}</td>
              <td>${persist.organization(appointment.organizationId).name}</td>
              <td>${persist.user(appointment.creator).loginName}</td>
              <td><fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${appointment.createTime}"/></td>
              <td>${appointment.status.display}<c:if test="${not empty appointment.reason}">（${appointment.reason}）</c:if></td>
              <td class="text-center">
                <a href="${ctx.host}/transport-revenue-appointments/${appointment.id}">详情</a>&nbsp;&nbsp;
                <a href="${ctx.host}/transport-revenue-appointments/${appointment.id}/delete" data-target="#delete" data-toggle="modal">删除</a>&nbsp;&nbsp;
                <c:if test="${not empty appointment.url}">
                  <a href="${appointment.url}" download>下载</a>
                </c:if>
              </td>
            </tr>
          </c:forEach>
        </tbody>
        
        <tfoot>
          <tr>
            <td colspan="11" class="no-vertical-padding">
              <div class="pull-left">
                <jsp:include page="/WEB-INF/include/page.jsp">
                  <jsp:param name="url" value="${ctx.host}/transport-revenue-appointments" />
                  <jsp:param name="queryString" value="${queryString}" />
                </jsp:include>
              </div>
            </td>
          </tr>
        </tfoot>
      </table>
    </div>
    
  </div>
         
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/report/appointment/transport-revenue-appointment-list.js" />
  <script type="text/javascript">
      require(['page/report/appointment/transport-revenue-appointment-list'], function(page) {
        page.init()
      })
  </script>
  
</body>
</html>